Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
gulp-chmod
Advanced tools
Change permissions of Vinyl files
$ npm install --save-dev gulp-chmod
const gulp = require('gulp');
const chmod = require('gulp-chmod');
gulp.task('default', () =>
gulp.src('src/app.js')
.pipe(chmod(0o755))
.pipe(gulp.dest('dist'))
);
or
const gulp = require('gulp');
const chmod = require('gulp-chmod');
gulp.task('default', () =>
gulp.src('src/app.js')
.pipe(chmod({
owner: {
read: true,
write: true,
execute: true
},
group: {
execute: true
},
others: {
execute: true
}
}))
.pipe(gulp.dest('dist'))
);
Type: number
Object
Can either be a chmod octal number or an object with the individual permissions specified.
Values depends on the current file, but these are the possible keys:
{
owner: {
read: true,
write: true,
execute: true
},
group: {
read: true,
write: true,
execute: true
},
others: {
read: true,
write: true,
execute: true
}
}
When read
, write
, and execute
are same, you can simplify the object:
{
read: true
}
Pass null
to not set permissions on files. Useful if you only want to set permissions on directories.
Type: true
number
Object
Same as mode
, but applies to directories. Specify true
to use the same value as mode
.
Combine it with gulp-filter to only change permissions on a subset of the files.
const gulp = require('gulp');
const gFilter = require('gulp-filter');
const chmod = require('gulp-chmod');
const filter = gFilter('src/cli.js', {restore: true});
gulp.task('default', () =>
gulp.src('src/*.js')
// filter a subset of the files
.pipe(filter)
// make them executable
.pipe(chmod(0o755))
// bring back the previously filtered out files
.pipe(filter.restore)
.pipe(gulp.dest('dist'))
);
MIT © Sindre Sorhus
FAQs
Change permissions of Vinyl files
The npm package gulp-chmod receives a total of 21,375 weekly downloads. As such, gulp-chmod popularity was classified as popular.
We found that gulp-chmod demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.